#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e4 + 5;
const int M = 1e5 + 5;
const double G = 9.8;
const double eps = 1e-8;
const double PI = acos(-1);

int n, m, V;
struct Q {
  double deg;
  int id;
  bool operator<(Q o) const { return deg < o.deg; }
} a[N];
double x[N], y[N];
struct Node {
  double x, y;
  double mxd;
  bool operator<(Node o) const {
    if (x != o.x) return x < o.x;
    return y >= o.y;
  }
} b[M];
double h(double d, double x) {
  double t = x / (V * cos(d));
  double y = V * sin(d) * t - 0.5 * G * t * t;
  return y;
}
double f(double x, double y) {
  double l = 0.0, r = PI / 4.0;
  while (l + eps < r) {
    double mid = (l + r) / 2;
    if (h(mid, x) > y)
      r = mid;
    else
      l = mid;
  }
  return l;
}
double g(double x) {
  double t = V * sin(x) / G;
  return V * cos(x) * t * 2;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> V;
  rep(i, 1, n) cin >> a[i].deg;
  rep(i, 1, n) a[i].id = i;
  cin >> m;
  rep(i, 1, m) cin >> b[i].x >> b[i].y;
  rep(i, 1, m) b[i].mxd = f(b[i].x, b[i].y);
  rep(i, 1, n) x[i] = g(a[i].deg);
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1);
  int r = 1;
  rep(i, 1, n) {
    while (r < m && a[i].deg > b[r].mxd) r++;
    if (a[i].deg <= b[r].mxd && b[r].x < x[a[i].id]) {
      double x1 = b[r].x;
      double y1 = h(a[i].deg, x1);
      x[a[i].id] = x1;
      y[a[i].id] = y1;
    }
  }
  rep(i, 1, n) {
    cout << fixed << setprecision(6) << x[i] << ' ';
    cout << fixed << setprecision(6) << y[i] << endl;
  }
  return 0;
}